# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=host-extract
pkgver=8.0134ad7
pkgrel=17
epoch=1
groups=('blackarch' 'blackarch-scanner' 'blackarch-webapp')
pkgdesc='Ruby script tries to extract all IP/Host patterns in page response of a given URL and JavaScript/CSS files of that URL.'
arch=('any')
url='https://code.google.com/p/host-extract/'
license=('GPL3')
depends=('ruby' 'ruby-mechanize' 'ruby-net-http-digest_auth' 'rubygems'
         'ruby-http-cookie' 'ruby-ntlm-http' 'ruby-webrobots' 'ruby-rubyntlm'
         'ruby-webrick')
makedepends=('git')
source=("git+https://github.com/jeffrbeyer/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README

  rm README

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec ruby /usr/share/$pkgname/$pkgname.rb "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

